package com.tangyuan.feignapis.headlines;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tangyuan.dto.UpdateHeadlinesDto;
import com.tangyuan.model.Headlines;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(name ="service-headlines",contextId = "feignApi-headlines")
public interface IHeadlinesFeignClient {

    /**
     * 根据标题模糊搜索
     */
    @GetMapping("/feignApi/headlines/searchArticle/{userId}/{name}/{pageNum}/{pageSize}")
    Page<Headlines> searchArticle(@PathVariable Long userId, @PathVariable("name") String name, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize);

    /**
     * 根据百家ID查询百家
     * @param userId 用户ID
     * @param headlinesId 百家ID
     * @return 百家数据
     */
    @GetMapping("/feignApi/headlines/getByHeadlinesId/{userId}/{headlinesId}")
    Headlines getByHeadlinesId(@PathVariable Long userId,@PathVariable("headlinesId") Long headlinesId);


    /**
     * 分页查询我发布的百家
     * @param userId 用户ID
     * @return 我发布的百家
     */
    @GetMapping("/feignApi/headlines/getMyHeadlinesByUserId/{userId}/{pageNum}/{pageSize}")
    List<Headlines> getMyHeadlinesByUserId(@PathVariable("userId") Long userId, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize);

    /**
     * 用户获得的百家点赞数量
     * @param userId 用户
     * @return 点赞数量
     */
    @GetMapping("/feignApi/headlines/getArticleThumpNumByUserId/{userId}")
    Long getArticleThumpNumByUserId(@PathVariable("userId") Long userId);

    /**
     * 我的点赞百家
     */
    @GetMapping("/feignApi/headlines/getMyTrumpHeadlines/{userId}/{pageNum}/{pageSize}")
    List<Headlines> getMyTrumpHeadlines(@PathVariable Long userId, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize);

    /**
     * 我的收藏百家
     */
    @GetMapping("/feignApi/headlines/getMyCollectArticle/{userId}/{pageNum}/{pageSize}")
    List<Headlines> getMyCollectArticle(@PathVariable Long userId, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize);

    /**
     * 修改headlines表的用户名或用户头像
     */
    @PostMapping("/feignApi/video/updateHeadlinesUserMessage")
    void updateHeadlinesUserMessage(@RequestBody UpdateHeadlinesDto updateHeadlinesDto);
}
